Skip to main content

Logging

Catalyst provides a global logger instance for server-side logging.


Usage

logger.info("User logged in");
logger.debug("Processing request", { userId: 123 });
logger.error("Failed to connect to database", error);

Log Levels

LevelUse Case
infoGeneral information
debugDetailed debugging
errorErrors and exceptions

Log Format

{
"level": "info",
"message": "User logged in",
"timestamp": "2024-01-15 10:30:45"
}

Configuration

Configure logging in config/config.json:

KeyDefaultDescription
ENABLE_DEBUG_LOGSfalseEnable debug-level logging
ENABLE_CONSOLE_LOGGINGtrueOutput logs to console
ENABLE_FILE_LOGGINGfalseWrite logs to files
config/config.json
{
"ENABLE_DEBUG_LOGS": true,
"ENABLE_CONSOLE_LOGGING": true,
"ENABLE_FILE_LOGGING": true
}

File Logging

When ENABLE_FILE_LOGGING is true:

  • Logs are written to the project root directory
  • Log files are automatically rotated
  • Logs older than 3 days are deleted